package com.csst.filter;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class HelloInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {

		// 4. 获取 ActionContext
		ActionContext actionContext = invocation.getInvocationContext();
		Map<String, Object> sessionMap = actionContext.getSession();
		if (sessionMap.get("user") != null) {
			return invocation.invoke();
		} else {
          return "login";
		}

	}
}
